﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RoleManager.aspx.cs" Inherits="Admin_RoleManager" %>

<%@ Register src="AdminMenu.ascx" tagname="AdminMenu" tagprefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <uc1:AdminMenu ID="AdminMenu1" runat="server" />
     <h1>
         
        角色管理</h1>
    <div>
        <asp:Label ID="lblMessage" runat="server"></asp:Label>
    </div>
    <asp:MultiView ID="Multiview" runat="server" ActiveViewIndex="0">
        <asp:View runat="server" ID="RoleListView">
            <div style="float: right; margin: 5px; clear: both">
                <asp:ImageButton ID="btnAdd" runat="server" SkinID="sknImageAdd" ToolTip="Add Role"
                    OnClick="AddNewRoleClicked"></asp:ImageButton>
            </div>
            <div class="grid">
                <asp:ListView ID="lvItems" DataSourceID="ldsItems" runat="server" OnItemCommand="ItemCommand">
                    <LayoutTemplate>
                        <table id="RoleList" runat="server" class="datatable" cellpadding="0" cellspacing="0">
                        <tr class="pager-row" style="font-weight:bold;font-size:14px;"><td>角色名</td><td>删除</td><td>查看用户角色</td><td>指定模版用户</td></tr>
                            <tr id="itemPlaceholder" runat="server" />
                        </table>
                        <div class="pager">
                            <asp:DataPager ID="pagerBottom" runat="server" PageSize="10">
                                <Fields>
                                    <asp:TemplatePagerField>
                                        <PagerTemplate>
                                        </PagerTemplate>
                                    </asp:TemplatePagerField>
                                    <asp:NextPreviousPagerField ButtonCssClass="command" FirstPageText="«" PreviousPageText="‹"
                                        RenderDisabledButtonsAsLabels="true" ShowFirstPageButton="true" ShowPreviousPageButton="true"
                                        ShowLastPageButton="false" ShowNextPageButton="false" />
                                    <asp:NumericPagerField ButtonCount="7" NumericButtonCssClass="command" CurrentPageLabelCssClass="current"
                                        NextPreviousButtonCssClass="command" />
                                    <asp:NextPreviousPagerField ButtonCssClass="command" LastPageText="»" NextPageText="›"
                                        RenderDisabledButtonsAsLabels="true" ShowFirstPageButton="false" ShowPreviousPageButton="false"
                                        ShowLastPageButton="true" ShowNextPageButton="true" />
                                </Fields>
                            </asp:DataPager>
                        </div>
                    </LayoutTemplate>
                    <ItemTemplate>
                        <tr id="item" runat="server" class="row">
                            <td>
                                <%# Eval("roleName")%>
                            </td>
                            <td style="text-align: left; white-space: nowrap;">
                                <asp:ImageButton ID="btnDelete" runat="server" SkinID="sknImageDelete" ToolTip="Delete"
                                    CommandName="DeleteItem" CommandArgument='<%# Eval("roleName")%>'></asp:ImageButton>
                            </td>
                            <td>
                                <asp:Button ID="btnUserRole" runat="server" Text="查看用户角色" CommandName="UserRole" CommandArgument='<%# Eval("RoleId")%>'/>
                            </td>
                            <td>
                             <asp:Button ID="Button1" runat="server" Text="指定模版用户" CommandName="RoleTemplate" CommandArgument='<%# Eval("RoleId")%>'/>
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:ListView>
            </div>
        </asp:View>
        <asp:View runat="server" ID="RoleEditor">
            <div class="form">
                <p>
                    <asp:Label ID="ltlRole" EnableViewState="false" runat="server" Text="RoleName" />
                    <asp:TextBox ID="txtRole" runat="server"></asp:TextBox>
                </p>
                <p>
                    <asp:Button ID="btnCancel" runat="server" Text="<%$Resources:SharedResources, Cancel%>"
                        EnableViewState="false" OnClick="CancelClicked" />
                    <asp:Button ID="btnSubmit" runat="server" Text="<%$Resources:SharedResources, Submit%>"
                        EnableViewState="false" OnClick="SaveClicked" />
                </p>
            </div>
        </asp:View>
        <asp:View ID="UserRoleView" runat="server">
        <div class="grid">
                <asp:ListView ID="lvUser"  runat="server">
                    <LayoutTemplate>
                        <table id="RoleList" runat="server" class="datatable" cellpadding="0" cellspacing="0">
                        <tr class="pager-row" style="font-weight:bold;font-size:14px;"><td>用户名</td></tr>
                            <tr id="itemPlaceholder" runat="server" />
                        </table>
                    </LayoutTemplate>
                    <ItemTemplate>
                        <tr id="item" runat="server" class="row">
                            <td>
                                <%# Eval("UserName")%>
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:ListView>
            </div>
             <div class="form">
                <p>
                    <asp:Button ID="Button2" runat="server" Text="<%$Resources:SharedResources, Back%>"
                        EnableViewState="false" OnClick="BackClicked" />
                </p>
            </div>
        </asp:View>
         <asp:View ID="RoleTemplateView" runat="server">
          <div class="form">
              <asp:DropDownList ID="ddlRoleTemplate" runat="server">
        </asp:DropDownList>
        </div>
        </asp:View>
    </asp:MultiView>
    <asp:LinqDataSource ID="ldsItems" runat="server" OnSelecting="Items_Selecting" />
    </form>
</body>
</html>
